package com.appwoo.txtws.component;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import com.appwoo.txtws.service.WebTimeControlService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class ScreenLockUnlockMonitor
{
  public static final int ACTION_SCREEN_LOCKUNLOCK = 1001;
  public static final String KEY_SCREEN_LOCKUNLOCK = "Key_Screen_LockUnlock";
  Context mContext;
  Handler mHandler;
  BroadcastReceiver mLockUnlockReceiver;

  public ScreenLockUnlockMonitor(Context paramContext)
  {
    this.mContext = paramContext;
  }

  public void closeMonitor()
  {
    if (this.mLockUnlockReceiver != null)
      this.mContext.unregisterReceiver(this.mLockUnlockReceiver);
  }

  public void openMonitor()
  {
    if (this.mLockUnlockReceiver == null)
      this.mLockUnlockReceiver = new ScreenOnReceiver();
    IntentFilter localIntentFilter = new IntentFilter();
    localIntentFilter.addAction("android.intent.action.SCREEN_OFF");
    localIntentFilter.addAction("android.intent.action.SCREEN_ON");
    localIntentFilter.addAction("android.intent.action.USER_PRESENT");
    this.mContext.registerReceiver(this.mLockUnlockReceiver, localIntentFilter);
  }

  public void setObserver(Handler paramHandler)
  {
    this.mHandler = paramHandler;
  }

  public class ScreenOnReceiver extends BroadcastReceiver
  {
    private static final String TAG = "ScreenOnReceiver";

    public ScreenOnReceiver()
    {
    }

    public void onReceive(Context paramContext, Intent paramIntent)
    {
      String str = paramIntent.getAction();
      Message localMessage = Message.obtain();
      localMessage.what = 1001;
      Bundle localBundle = new Bundle();
      if ("android.intent.action.SCREEN_ON".equals(str))
      {
        if (WebTimeControlService.scheduler.isShutdown())
        {
          WebTimeControlService.scheduler = Executors.newScheduledThreadPool(20);
          WebTimeControlService.scheduler.scheduleWithFixedDelay(WebTimeControlService.dr, 3L, 28L, TimeUnit.SECONDS);
          WebTimeControlService.scheduler.scheduleWithFixedDelay(WebTimeControlService.cr, 5L, 2L, TimeUnit.SECONDS);
          if (!FilterSoft.IsCustomVersion())
            WebTimeControlService.scheduler.scheduleWithFixedDelay(WebTimeControlService.dkr, 3L, 200L, TimeUnit.MILLISECONDS);
        }
        Log.i("check", "Screen on");
      }
      while (true)
      {
        localMessage.setData(localBundle);
        if (ScreenLockUnlockMonitor.this.mHandler != null)
          ScreenLockUnlockMonitor.this.mHandler.sendMessage(localMessage);
        return;
        if (!"android.intent.action.USER_PRESENT".equals(str))
        {
          WebTimeControlService.scheduler.shutdown();
          Log.i("check", "Screen off");
        }
      }
    }
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.appwoo.txtws.component.ScreenLockUnlockMonitor
 * JD-Core Version:    0.6.2
 */